Skip to content

Fix proposal vote percentage calculation#228

Open
shashankvaishnav wants to merge 1 commit into
effectai:mainfrom
shashankvaishnav:fix-proposal-vote-percentage
Open

Fix proposal vote percentage calculation#228
shashankvaishnav wants to merge 1 commit into
effectai:mainfrom
shashankvaishnav:fix-proposal-vote-percentage

Conversation

@shashankvaishnav

@shashankvaishnav shashankvaishnav commented May 12, 2026

Copy link
Copy Markdown

Closes #184.

This updates the vote percentage calculation to sum the available vote_count rows instead of assuming all three vote types are present. Older proposals can omit vote types with zero weight, which caused proposal #1 to fail when the UI accessed a missing array entry.

Validation:

  • git diff --check
  • npm run lint (fails locally because dependencies are not installed: eslint not found)

@shashankvaishnav

Copy link
Copy Markdown
Author

Hi maintainers, I opened this PR for #184.

The fix avoids assuming all three vote_count entries exist and instead sums the vote_count rows returned by the chain table. This should handle older proposals like proposal #1 where zero-value vote types were not stored.

Could you review when you have time?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

First proposal doesn't show votes

1 participant